checkout: fsync() directory on checkouts
authorColin Walters <walters@verbum.org>
Tue, 8 Apr 2014 21:31:17 +0000 (17:31 -0400)
committerColin Walters <walters@verbum.org>
Fri, 11 Apr 2014 22:43:13 +0000 (18:43 -0400)
We want to be really sure that our deployment roots have hit the disk.

src/libostree/ostree-repo-checkout.c

index 126545debfdc12a84e148f5a662cc0cd5fb47219..7bf832895e2c85d4c66b3bf112ec97ace5d73358 100644 (file)
@@ -657,6 +657,16 @@ checkout_tree_at (OstreeRepo                        *self,
         }
     }
 
+  /* Finally, fsync to ensure all entries are on disk.  Ultimately
+   * this should be configurable for the case where we're constructing
+   * buildroots.
+   */
+  if (fsync (destination_dfd) == -1)
+    {
+      ot_util_set_error_from_errno (error, errno);
+      goto out;
+    }
+
   ret = TRUE;
  out:
   if (destination_dfd != -1)